package com.soap.desensitize.encry.rreversible.symmetry;

import com.soap.desensitize.encry.IDesensitization;
import com.soap.desensitize.exception.strategy.DecodeException;
import com.soap.desensitize.exception.strategy.EncodeException;

/**
 * @desc 	对称加密抽象基类
 * @author 	高增源
 * @time	2022-04-20
 */
public abstract class AbstractSymmetryEncry<T> implements IDesensitization<T> {
    /**
     * 偏移变量，固定占8位字节
     */
    private String IV_PARAMETER = "javaplus";

    /**
     * @desc 对称加密的密码
     */
    public String password;

    /**
     * @desc  根据密码加密
     * @param password
     * @param data
     * @return
     */
    public abstract T encode(String password, T data) throws EncodeException;

    /**
     * @desc  根据密码解密
     * @param password
     * @param data
     * @return
     */
    public abstract T decode(String password, T data) throws DecodeException;

    public String getIV_PARAMETER() {
        return IV_PARAMETER;
    }

    public void setIV_PARAMETER(String IV_PARAMETER) {
        this.IV_PARAMETER = IV_PARAMETER;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}
